package Box2D.Dynamics.Joints
{
	import Box2D.Common.Math.b2Vec2;

	/// A revolute joint constrains two bodies to share a common point while they
	/// are free to rotate about the point. The relative rotation about the shared
	/// point is the joint angle. You can limit the relative rotation with
	/// a joint limit that specifies a lower and upper angle. You can use a motor
	/// to drive the relative rotation about the shared point. A maximum motor torque
	/// is provided so that infinite forces are not generated.
	public class b2RevoluteJoint extends b2Joint
	{
		public function b2RevoluteJoint(wrapper:Object=null)
		{
			super(wrapper);
		}
		/// Get the current joint angle in radians.
		public function GetJointAngle():Number
		{
			return call('b2RevoluteJoint_GetJointAngle')			
		}
		/// Get the current joint angle speed in radians per second.
		public function GetJointSpeed():Number
		{
			return call('b2RevoluteJoint_GetJointSpeed')		
		}
		/// Is the joint limit enabled?
		public function IsLimitEnabled():Boolean
		{
			return call('b2RevoluteJoint_IsLimitEnabled')		
		}
		/// Enable/disable the joint limit.
		public function EnableLimit(flag:Boolean):void{
			call('b2RevoluteJoint_EnableLimit',flag)	
		}
		/// Get the lower joint limit in radians.
		public function GetLowerLimit():Number{
			return call('b2RevoluteJoint_GetLowerLimit')	
		}
		/// Get the upper joint limit in radians.
		public function GetUpperLimit():Number{
			return call('b2RevoluteJoint_GetUpperLimit')	
		}
		public function SetLimits(lower:Number,upper:Number):void{
			call('b2RevoluteJoint_SetLimits',lower,upper)
		}
		public function IsMotorEnabled():Boolean{
			return call('b2RevoluteJoint_IsMotorEnabled')
		}
		public function EnableMotor(flag:Boolean):void{
			call('b2RevoluteJoint_EnableMotor',flag)
		}
		public function SetMotorSpeed(speed:Number):void{
			call('b2RevoluteJoint_SetMotorSpeed',speed)	
		}
		public function GetMotorSpeed():Number{
			return call('b2RevoluteJoint_GetMotorSpeed')	
		}
		public function SetMaxMotorTorque(torque:Number):void{
			call('b2RevoluteJoint_SetMaxMotorTorque',torque)
		}
		/// Get the current motor torque given the inverse time step.
		/// Unit is N*m.
		public function GetMotorTorque(inv_dt:Number):Number{
			return call('b2RevoluteJoint_GetMotorTorque',inv_dt)	
		}
	}
}